/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package com.xiashitech.agent.instrumentation.dubbo.common.inst;

import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.dubbo.rpc.RpcInvocation;
import lombok.AllArgsConstructor;
import lombok.Data;

import javax.annotation.Nullable;
import java.net.InetSocketAddress;

@AllArgsConstructor
@Data
public class DubboRequest {

  static DubboRequest create(RpcInvocation invocation, RpcContext context) {
    return new DubboRequest(invocation, context, context.getUrl(), context.getRemoteAddress());
  }

  public RpcInvocation invocation;

  public RpcContext context;

  public URL url;

  @Nullable
  public InetSocketAddress remoteAddress;
}
